<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>onclick 事件调用函数时使用 onclick=函数名+()</title>
    <script>
        function myfunction() {
            document.getElementById("demo").innerHTML = "onclick事件触发";
        }
    </script>
</head>

<body>
    <h1 id="demo">一个段落</h1>
    <button onclick="myfunction()" type="button">点击这里</button>
</body>

</html>